home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / WASTE 1.2 / WASTE Pascal Interfaces / WASTE.p < prev   
Text File  |  1996-06-26  |  26KB  |  829 lines

  1. unit WASTE;
  2.  
  3. { Pascal interface to the WASTE text engine }
  4.  
  5. { version 1.2 (June 1996) }
  6.  
  7. { Copyright © 1993-1996 Marco Piovanelli }
  8. { All Rights Reserved }
  9.  
  10. interface
  11.     uses
  12.         ConditionalMacros,
  13.         Types,
  14.         MixedMode,
  15.         QuickdrawText,
  16.         Quickdraw,
  17.         Script,
  18.         TextUtils,
  19.         TextEdit,
  20.         Drag,
  21.         LongCoords;
  22.  
  23. {$PUSH}
  24. {$ALIGN MAC68K}
  25. {$LibExport+}
  26.  
  27.     const
  28.  
  29. { result codes }
  30.  
  31.         weCantUndoErr = -10015;                    { undo buffer is clear (= errAECantUndo) }
  32.         weEmptySelectionErr = -10013;            { empty selection range (= errAENoUserSelection) }
  33.         weNotHandledErr = -1708;                    { please use default behavior (= errAEEventNotHandled) }
  34.         weUnknownObjectTypeErr = -9478;        { specified object type is not registered }
  35.         weObjectNotFoundErr = -9477;                { no object found at specified offset }
  36.         weReadOnlyErr = -9476;                        { cannot modify instance }
  37.         weUndefinedSelectorErr = -50;                { unknown selector (= paramErr) }
  38.  
  39. { alignment styles }
  40.  
  41.         weFlushLeft = -2;                        { flush left }
  42.         weFlushRight = -1;                    { flush right }
  43.         weFlushDefault = 0;                    { flush according to system direction }
  44.         weCenter = 1;                            { centered }
  45.         weJustify = 2;                            { fully justified }
  46.  
  47. { values for the mode parameter in WESetStyle and WEContinuousStyle }
  48.  
  49.         weDoFont                         = $0001;    { set font family number }
  50.         weDoFace                         = $0002;    { set Quickdraw styles }
  51.         weDoSize                             = $0004;    { set type size }
  52.         weDoColor                         = $0008;    { set color }
  53.         weDoAll                             = weDoFont + weDoFace + weDoSize + weDoColor;
  54.         weDoAddSize                     = $0010;    { adjust type size }
  55.         weDoToggleFace                 = $0020;    { turn a style off if it's continuous over the selection }
  56.         weDoReplaceFace                 = $0040;    { replace existing styles outright }
  57.         weDoPreserveScript            = $0080;    { don't change scripts when applying a font change }
  58.         weDoExtractSubscript         = $0100;    { extract subscripts when applying a font change }
  59.         weDoFaceMask                 = $0200;    { set Quickdraw styles using mask field }
  60.  
  61. { values for the edge parameter in WEGetOffset etc. }
  62.  
  63.         kLeadingEdge = -1;                    { point is on the leading edge of a glyph }
  64.         kTrailingEdge = 0;                        { point is on the trailing edge of a glyph }
  65.         kObjectEdge = 2;                        { point is in the middle of an embedded object }
  66.  
  67. { values for WEFeatureFlag feature parameter }
  68.  
  69.         weFAutoScroll                 = 0;            { automatically scroll the selection range into view }
  70.         weFOutlineHilite             = 2;            { frame selection when deactivated }
  71.         weFReadOnly                 = 5;            { disallow modifications }
  72.         weFUndo                         = 6;            { support WEUndo }
  73.         weFIntCutAndPaste         = 7;            { use intelligent cut-and-paste rules }
  74.         weFDragAndDrop         = 8;            { support drag-and-drop text editing }
  75.         weFInhibitRecal             = 9;            { don't recalculate line starts and don't redraw text }
  76.         weFUseTempMem         = 10;            { use temporary memory for main data structures }
  77.         weFDrawOffscreen         = 11;            { draw text offscreen for smoother visual results }
  78.         weFInhibitRedraw         = 12;            { don't redraw text }
  79.         weFMonoStyled            = 13;            { disallow style changes }
  80.         weFInhibitColor             = 31;            { draw in black & white only }
  81.  
  82. { values for WENew flags parameter }
  83.  
  84.         weDoAutoScroll                 = $00000001;
  85.         weDoOutlineHilite             = $00000004;
  86.         weDoReadOnly                     = $00000020;
  87.         weDoUndo                         = $00000040;
  88.         weDoIntCutAndPaste         = $00000080;
  89.         weDoDragAndDrop             = $00000100;
  90.         weDoInhibitRecal             = $00000200;
  91.         weDoUseTempMem             = $00000400;
  92.         weDoDrawOffscreen             = $00000800;
  93.         weDoInhibitRedraw            = $00001000;
  94.         weDoMonoStyled                = $00002000;
  95.         weDoInhibitColor                = $80000000;
  96.  
  97. { values for WEFeatureFlag action parameter }
  98.  
  99.         weBitToggle = -2;                        { toggles the specified feature }
  100.         weBitTest = -1;                            { returns the current setting of the specified feature }
  101.         weBitClear = 0;                            { disables the specified feature }
  102.         weBitSet = 1;                            { enables the specified feature }
  103.  
  104. { values for WEGetInfo and WESetInfo selector parameter }
  105.  
  106.         weCharByteHook = 'cbyt';                { CharByte hook }
  107.         weCharToPixelHook = 'c2p ';            { CharToPixel hook }
  108.         weCharTypeHook = 'ctyp';                { CharType hook }
  109.         weClickLoop = 'clik';                        { click loop callback }
  110.         weCurrentDrag = 'drag';                { drag currently being tracked from WEClick }
  111.         weDrawTextHook = 'draw';            { text drawing hook }
  112.         weHiliteDropAreaHook = 'hidr';        { drop area highlighting hook }
  113.         weLineBreakHook = 'lbrk';            { line breaking hook }
  114.         wePixelToCharHook = 'p2c ';            { PixelToChar hook }
  115.         wePort = 'port';                                { graphics port }
  116.         weRefCon = 'refc';                            { reference constant for use by application }
  117.         weScrollProc = 'scrl';                        { scroll callback }
  118.         weText = 'text';                                { handle to the raw text }
  119.         weTranslateDragHook = 'xdrg';        { drag translation callback }
  120.         weTSMDocumentID = 'tsmd';            { Text Services Manager document ID }
  121.         weTSMPreUpdate = 'pre ';                { Text Services Manager pre-update callback }
  122.         weTSMPostUpdate = 'post';            { Text Services Manager post-update callback }
  123.         weURLHint = 'urlh';                        { URL hint string for Internet Config }
  124.         weWordBreakHook = 'wbrk';        { word breaking hook }
  125.  
  126. { values for WEInstallObjectHandler handlerSelector parameter }
  127.  
  128.         weNewHandler = 'new ';            { new handler }
  129.         weDisposeHandler = 'free';        { dispose handler }
  130.         weDrawHandler = 'draw';            { draw handler }
  131.         weClickHandler = 'clik';                { click handler }
  132.         weStreamHandler = 'strm';        { stream handler }
  133.  
  134. { action kinds }
  135.  
  136.         weAKNone                 = 0;                { null action }
  137.         weAKUnspecified     = 1;                { action of unspecified nature }
  138.         weAKTyping             = 2;                { some text has been typed in }
  139.         weAKCut                     = 3;                { the selection range has been cut }
  140.         weAKPaste                 = 4;                { something has been pasted }
  141.         weAKClear                 = 5;                { the selection range has been deleted }
  142.         weAKDrag                 = 6;                { drag and drop operation }
  143.         weAKSetStyle             = 7;                { some style has been applied to a text range }
  144.  
  145. { destination kinds for stream handler }
  146.  
  147.         weToScrap        =    0;
  148.         weToDrag            =    1;
  149.         weToSoup            =    2;
  150.  
  151.     type
  152.  
  153. { if we're using a pre-2.1 version of the Universal Headers, define EventModifiers }
  154. {$IFC UNDEFINED UNIVERSAL_INTERFACES_VERSION}
  155.     type
  156.         EventModifiers = Integer;
  157. {$ENDC}
  158.  
  159. { WASTE data types }
  160.  
  161.         WEReference = Ptr;
  162.         WEObjectReference = Ptr;
  163.         WESoupHandle = Handle;
  164.         WEActionKind = Integer;
  165.         WEAlignment = SignedByte;
  166.         WEStyleMode = Integer;
  167.         WESelector = FourCharCode;
  168.         WEHandle = WEReference;        { obsolete; kept for backward compatibility }
  169.  
  170.         WERunInfo = record
  171.                 runStart: LongInt;                            { byte offset to first character of style run }
  172.                 runEnd: LongInt;                            { byte offset past last character of style run }
  173.                 runHeight: Integer;                        { line height (ascent + descent + leading) }
  174.                 runAscent: Integer;                        { font ascent }
  175.                 runStyle: TextStyle;                        { text attributes }
  176.                 runObject: WEObjectReference;        { either NIL or reference to embedded object }
  177.             end;  { WERunInfo }
  178.  
  179. { callback prototypes }
  180.  
  181. { FUNCTION MyClickLoop(we: WEReference): Boolean; }
  182.         WEClickLoopProcPtr = ProcPtr;
  183.         WEClickLoopUPP = UniversalProcPtr;
  184.  
  185. { PROCEDURE MyScrollProc(we: WEReference); }
  186.         WEScrollProcPtr = ProcPtr;
  187.         WEScrollUPP = UniversalProcPtr;
  188.  
  189. { PROCEDURE MyTSMPreUpdate(we: WEReference); }
  190.         WETSMPreUpdateProcPtr = ProcPtr;
  191.         WETSMPreUpdateUPP = UniversalProcPtr;
  192.  
  193. { PROCEDURE MyTSMPostUpdate(we: WEReference; fixLength: LongInt; }
  194. {         inputAreaStart, inputAreaEnd:LongInt; }
  195. {        pinRangeStart, pinRangeEnd: LongInt); }
  196.         WETSMPostUpdateProcPtr = ProcPtr;
  197.         WETSMPostUpdateUPP = UniversalProcPtr;
  198.  
  199. { FUNCTION MyTranslateDrag (theDrag: DragReference; theItem: ItemReference; }
  200. {         requestedType: FlavorType; putDataHere: Handle): OSErr; }
  201.         WETranslateDragProcPtr = ProcPtr;
  202.         WETranslateDragUPP = UniversalProcPtr;
  203.  
  204. { FUNCTION MyHiliteDropArea (theDrag: DragReference; hiliteFlag: Boolean; }
  205. {        we: WEReference); }
  206.         WEHiliteDropAreaProcPtr = ProcPtr;
  207.         WEHiliteDropAreaUPP = UniversalProcPtr;
  208.  
  209. { PROCEDURE MyDrawText (pText: Ptr; textLength: LongInt; slop: Fixed; }
  210. {         styleRunPosition: JustStyleCode; we: WEReference); }
  211.         WEDrawTextProcPtr = ProcPtr;
  212.         WEDrawTextUPP = UniversalProcPtr;
  213.  
  214. { FUNCTION MyPixelToChar (pText: Ptr; textLength: LongInt; slop: Fixed; }
  215. {         var pixelWidth: Fixed; var edge: SignedByte; }
  216. {         styleRunPosition: JustStyleCode; hPos: Fixed; we: WEReference): LongInt; }
  217.         WEPixelToCharProcPtr = ProcPtr;
  218.         WEPixelToCharUPP = UniversalProcPtr;
  219.  
  220. { FUNCTION MyCharToPixel (pText: Ptr; textLength: LongInt; slop: Fixed; }
  221. {        offset: LongInt; direction: Integer; }
  222. {        styleRunPosition: JustStyleCode; hPos: LongInt; we:WEReference): Integer; }
  223.         WECharToPixelProcPtr = ProcPtr;
  224.         WECharToPixelUPP = UniversalProcPtr;
  225.  
  226. { FUNCTION MyLineBreak (pText: Ptr; textLength: LongInt; }
  227. {        textStart, textEnd: LongInt; var textWidth: Fixed; var textOffset: LongInt; }
  228. {        we: WEReference): StyledLineBreakCode; }
  229.         WELineBreakProcPtr = ProcPtr;
  230.         WELineBreakUPP = UniversalProcPtr;
  231.  
  232. { PROCEDURE MyWordBreak (pText: Ptr; textLength, offset: Integer; edge: SignedByte; }
  233. {                    var breakOffsets: OffsetTable; script: ScriptCode; we: WEReference); }
  234.         WEWordBreakProcPtr = ProcPtr;
  235.         WEWordBreakUPP = UniversalProcPtr;
  236.  
  237. { FUNCTION MyCharByte (pText: Ptr; textOffset: Integer; }
  238. {                     script: ScriptCode; we: WEReference): Integer; }
  239.         WECharByteProcPtr = ProcPtr;
  240.         WECharByteUPP = UniversalProcPtr;
  241.  
  242. { FUNCTION MyCharType (pText: Ptr; textOffset: Integer; }
  243. {                     script: ScriptCode; we: WEReference): Integer; }
  244.         WECharTypeProcPtr = ProcPtr;
  245.         WECharTypeUPP = UniversalProcPtr;
  246.  
  247. { FUNCTION MyNewObject (var defaultObjectSize: Point; }
  248. {                    objectRef: WEObjectReference): OSErr; }
  249.         WENewObjectProcPtr = ProcPtr;
  250.         WENewObjectUPP = UniversalProcPtr;
  251.  
  252. { FUNCTION MyDisposeObject (objectRef: WEObjectReference): OSErr; }
  253.         WEDisposeObjectProcPtr = ProcPtr;
  254.         WEDisposeObjectUPP = UniversalProcPtr;
  255.  
  256. { FUNCTION MyDrawObject (var destRect: Rect; }
  257. {         objectRef: WEObjectReference): OSErr }
  258.         WEDrawObjectProcPtr = ProcPtr;
  259.         WEDrawObjectUPP = UniversalProcPtr;
  260.  
  261. { FUNCTION MyClickObject (hitPt: Point; modifiers: EventModifiers; clickTime: LongInt; }
  262. {         objectRef: WEObjectReference): Boolean; }
  263.         WEClickObjectProcPtr = ProcPtr;
  264.         WEClickObjectUPP = UniversalProcPtr;
  265.  
  266. { FUNCTION MyStreamObject (destKind: Integer; var theType: FlavorType; }
  267. {        putDataHere: Handle; objectRef: WEObjectReference): OSErr; }
  268.         WEStreamObjectProcPtr = ProcPtr;
  269.         WEStreamObjectUPP = UniversalProcPtr;
  270.  
  271.     const
  272.  
  273. { UPP proc info }
  274.  
  275.         uppWEClickLoopProcInfo = $000000D0;
  276.         uppWEScrollProcInfo = $000000C0;
  277.         uppWETSMPreUpdateProcInfo = $000000C0;
  278.         uppWETSMPostUpdateProcInfo = $0003FFC0;
  279.         uppWETranslateDragProcInfo = $0003FFE0;
  280.         uppWEHiliteDropAreaProcInfo = $00000DE0;
  281.         uppWEDrawTextProcInfo = $0000EFC0;
  282.         uppWEPixelToCharProcInfo = $003EFFF0;
  283.         uppWECharToPixelProcInfo = $003EBFE0;
  284.         uppWELineBreakProcInfo = $000FFFD0;
  285.         uppWEWordBreakProcInfo = $000EDAC0;
  286.         uppWECharByteProcInfo = $00003AE0;
  287.         uppWECharTypeProcInfo = $00003AE0;
  288.         uppWENewObjectProcInfo = $000003E0;
  289.         uppWEDisposeObjectProcInfo = $000000E0;
  290.         uppWEDrawObjectProcInfo = $000003E0;
  291.         uppWEClickObjectProcInfo = $00003ED0;
  292.         uppWEStreamObjectProcInfo = $00003FA0;
  293.  
  294. { NewProc macros }
  295.  
  296.     function NewWEClickLoopProc (userRoutine: WEClickLoopProcPtr): WEClickLoopUPP;
  297. {$IFC NOT GENERATINGCFM}
  298.     inline
  299.         $2E9F;
  300. {$ENDC}
  301.  
  302.     function NewWEScrollProc (userRoutine: WEScrollProcPtr): WEScrollUPP;
  303. {$IFC NOT GENERATINGCFM}
  304.     inline
  305.         $2E9F;
  306. {$ENDC}
  307.  
  308.     function NewWETSMPreUpdateProc (userRoutine: WETSMPreUpdateProcPtr): WETSMPreUpdateUPP;
  309. {$IFC NOT GENERATINGCFM}
  310.     inline
  311.         $2E9F;
  312. {$ENDC}
  313.  
  314.     function NewWETSMPostUpdateProc (userRoutine: WETSMPostUpdateProcPtr): WETSMPostUpdateUPP;
  315. {$IFC NOT GENERATINGCFM}
  316.     inline
  317.         $2E9F;
  318. {$ENDC}
  319.  
  320.     function NewWETranslateDragProc (userRoutine: WETranslateDragProcPtr): WETranslateDragUPP;
  321. {$IFC NOT GENERATINGCFM}
  322.     inline
  323.         $2E9F;
  324. {$ENDC}
  325.  
  326.     function NewWEHiliteDropAreaProc (userRoutine: WEHiliteDropAreaProcPtr): WEHiliteDropAreaUPP;
  327. {$IFC NOT GENERATINGCFM}
  328.     inline
  329.         $2E9F;
  330. {$ENDC}
  331.  
  332.     function NewWEDrawTextProc (userRoutine: WEDrawTextProcPtr): WEDrawTextUPP;
  333. {$IFC NOT GENERATINGCFM}
  334.     inline
  335.         $2E9F;
  336. {$ENDC}
  337.  
  338.     function NewWEPixelToCharProc (userRoutine: WEPixelToCharProcPtr): WEPixelToCharUPP;
  339. {$IFC NOT GENERATINGCFM}
  340.     inline
  341.         $2E9F;
  342. {$ENDC}
  343.  
  344.     function NewWECharToPixelProc (userRoutine: WECharToPixelProcPtr): WECharToPixelUPP;
  345. {$IFC NOT GENERATINGCFM}
  346.     inline
  347.         $2E9F;
  348. {$ENDC}
  349.  
  350.     function NewWELineBreakProc (userRoutine: WELineBreakProcPtr): WELineBreakUPP;
  351. {$IFC NOT GENERATINGCFM}
  352.     inline
  353.         $2E9F;
  354. {$ENDC}
  355.  
  356.     function NewWEWordBreakProc (userRoutine: WEWordBreakProcPtr): WEWordBreakUPP;
  357. {$IFC NOT GENERATINGCFM}
  358.     inline
  359.         $2E9F;
  360. {$ENDC}
  361.  
  362.     function NewWECharByteProc (userRoutine: WECharByteProcPtr): WECharByteUPP;
  363. {$IFC NOT GENERATINGCFM}
  364.     inline
  365.         $2E9F;
  366. {$ENDC}
  367.  
  368.     function NewWECharTypeProc (userRoutine: WECharTypeProcPtr): WECharTypeUPP;
  369. {$IFC NOT GENERATINGCFM}
  370.     inline
  371.         $2E9F;
  372. {$ENDC}
  373.  
  374.     function NewWENewObjectProc (userRoutine: WENewObjectProcPtr): WENewObjectUPP;
  375. {$IFC NOT GENERATINGCFM}
  376.     inline
  377.         $2E9F;
  378. {$ENDC}
  379.  
  380.     function NewWEDisposeObjectProc (userRoutine: WEDisposeObjectProcPtr): WEDisposeObjectUPP;
  381. {$IFC NOT GENERATINGCFM}
  382.     inline
  383.         $2E9F;
  384. {$ENDC}
  385.  
  386.     function NewWEDrawObjectProc (userRoutine: WEDrawObjectProcPtr): WEDrawObjectUPP;
  387. {$IFC NOT GENERATINGCFM}
  388.     inline
  389.         $2E9F;
  390. {$ENDC}
  391.  
  392.     function NewWEClickObjectProc (userRoutine: WEClickObjectProcPtr): WEClickObjectUPP;
  393. {$IFC NOT GENERATINGCFM}
  394.     inline
  395.         $2E9F;
  396. {$ENDC}
  397.  
  398.     function NewWEStreamObjectProc (userRoutine: WEStreamObjectProcPtr): WEStreamObjectUPP;
  399. {$IFC NOT GENERATINGCFM}
  400.     inline
  401.         $2E9F;
  402. {$ENDC}
  403.  
  404. { CallProc macros }
  405.  
  406.     function CallWEClickLoopProc (we: WEReference;
  407.                                     userRoutine: WEClickLoopUPP): Boolean;
  408. {$IFC NOT GENERATINGCFM}
  409.     inline
  410.         $205F, $4E90;
  411. {$ENDC}
  412.  
  413.     procedure CallWEScrollProc (we: WEReference;
  414.                                     userRoutine: WEScrollUPP);
  415. {$IFC NOT GENERATINGCFM}
  416.     inline
  417.         $205F, $4E90;
  418. {$ENDC}
  419.  
  420.     procedure CallWETSMPreUpdateProc (we: WEReference;
  421.                                     userRoutine: WETSMPreUpdateUPP);
  422. {$IFC NOT GENERATINGCFM}
  423.     inline
  424.         $205F, $4E90;
  425. {$ENDC}
  426.  
  427.     procedure CallWETSMPostUpdateProc (we: WEReference;
  428.                                     fixLength: LongInt;
  429.                                     inputAreaStart, inputAreaEnd: LongInt;
  430.                                     pinRangeStart, pinRangeEnd: LongInt;
  431.                                     userRoutine: WETSMPostUpdateUPP);
  432. {$IFC NOT GENERATINGCFM}
  433.     inline
  434.         $205F, $4E90;
  435. {$ENDC}
  436.  
  437.     function CallWETranslateDragProc (theDrag: DragReference;
  438.                                     theItem: ItemReference;
  439.                                     requestedType: FlavorType;
  440.                                     putDataHere: Handle;
  441.                                     userRoutine: WETranslateDragUPP): OSErr;
  442. {$IFC NOT GENERATINGCFM}
  443.     inline
  444.         $205F, $4E90;
  445. {$ENDC}
  446.  
  447.     function CallWEHiliteDropAreaProc (theDrag: DragReference;
  448.                                     hiliteFlag: Boolean;
  449.                                     we: WEReference;
  450.                                     userRoutine: WEHiliteDropAreaUPP): OSErr;
  451. {$IFC NOT GENERATINGCFM}
  452.     inline
  453.         $205F, $4E90;
  454. {$ENDC}
  455.  
  456.     procedure CallWEDrawTextProc (pText: Ptr;
  457.                                     textLength: LongInt;
  458.                                     slop: Fixed;
  459.                                     styleRunPosition: JustStyleCode;
  460.                                     we: WEReference;
  461.                                     userRoutine: WEDrawTextUPP);
  462. {$IFC NOT GENERATINGCFM}
  463.     inline
  464.         $205F, $4E90;
  465. {$ENDC}
  466.  
  467.     function CallWEPixelToCharProc (pText: Ptr;
  468.                                     textLength: LongInt;
  469.                                     slop: Fixed;
  470.                                     var width: Fixed;
  471.                                     var edge: SignedByte;
  472.                                     styleRunPosition: JustStyleCode;
  473.                                     hPos: Fixed;
  474.                                     we: WEReference;
  475.                                     userRoutine: WEPixelToCharUPP): LongInt;
  476. {$IFC NOT GENERATINGCFM}
  477.     inline
  478.         $205F, $4E90;
  479. {$ENDC}
  480.  
  481.     function CallWECharToPixelProc (pText: Ptr;
  482.                                     textLength: LongInt;
  483.                                     slop: Fixed;
  484.                                     offset: LongInt;
  485.                                     direction: Integer;
  486.                                     styleRunPosition: JustStyleCode;
  487.                                     hPos: LongInt;
  488.                                     we: WEReference;
  489.                                     userRoutine: WECharToPixelUPP): Integer;
  490. {$IFC NOT GENERATINGCFM}
  491.     inline
  492.         $205F, $4E90;
  493. {$ENDC}
  494.  
  495.     function CallWELineBreakProc (pText: Ptr;
  496.                                     textLength: LongInt;
  497.                                     textStart, textEnd: LongInt;
  498.                                     var textWidth: Fixed;
  499.                                     var textOffset: LongInt;
  500.                                     we: WEReference;
  501.                                     userRoutine: WELineBreakUPP): StyledLineBreakCode;
  502. {$IFC NOT GENERATINGCFM}
  503.     inline
  504.         $205F, $4E90;
  505. {$ENDC}
  506.  
  507.     procedure CallWEWordBreakProc (pText: Ptr;
  508.                                     textLength, offset: Integer;
  509.                                     edge: SignedByte;
  510.                                     var breakOffsets: OffsetTable;
  511.                                     script: ScriptCode;
  512.                                     we: WEReference;
  513.                                     userRoutine: WEWordBreakUPP);
  514. {$IFC NOT GENERATINGCFM}
  515.     inline
  516.         $205F, $4E90;
  517. {$ENDC}
  518.  
  519.     function CallWECharByteProc (pText: Ptr;
  520.                                     textOffset: Integer;
  521.                                     script: ScriptCode;
  522.                                     we: WEReference;
  523.                                     userRoutine: WECharByteUPP): Integer;
  524. {$IFC NOT GENERATINGCFM}
  525.     inline
  526.         $205F, $4E90;
  527. {$ENDC}
  528.  
  529.     function CallWECharTypeProc (pText: Ptr;
  530.                                     textOffset: Integer;
  531.                                     script: ScriptCode;
  532.                                     we: WEReference;
  533.                                     userRoutine: WECharTypeUPP): Integer;
  534. {$IFC NOT GENERATINGCFM}
  535.     inline
  536.         $205F, $4E90;
  537. {$ENDC}
  538.  
  539.     function CallWENewObjectProc (var defaultObjectSize: Point;
  540.                                     objectRef: WEObjectReference;
  541.                                     userRoutine: WENewObjectUPP): OSErr;
  542. {$IFC NOT GENERATINGCFM}
  543.     inline
  544.         $205F, $4E90;
  545. {$ENDC}
  546.  
  547.     function CallWEDisposeObjectProc (objectRef: WEObjectReference;
  548.                                     userRoutine: WEDisposeObjectUPP): OSErr;
  549. {$IFC NOT GENERATINGCFM}
  550.     inline
  551.         $205F, $4E90;
  552. {$ENDC}
  553.  
  554.     function CallWEDrawObjectProc ({const} var destRect: Rect;
  555.                                     objectRef: WEObjectReference;
  556.                                     userRoutine: WEDrawObjectUPP): OSErr;
  557. {$IFC NOT GENERATINGCFM}
  558.     inline
  559.         $205F, $4E90;
  560. {$ENDC}
  561.  
  562.     function CallWEClickObjectProc (hitPoint: Point;
  563.                                     modifiers: EventModifiers;
  564.                                     clickTime: LongInt;
  565.                                     objectRef: WEObjectReference;
  566.                                     userRoutine: WEClickObjectUPP): Boolean;
  567. {$IFC NOT GENERATINGCFM}
  568.     inline
  569.         $205F, $4E90;
  570. {$ENDC}
  571.  
  572.     function CallWEStreamObjectProc (destKind: Integer;
  573.                                     var theType: FlavorType;
  574.                                     putDataHere: Handle;
  575.                                     objectRef: WEObjectReference;
  576.                                     userRoutine: WEStreamObjectUPP): OSErr;
  577. {$IFC NOT GENERATINGCFM}
  578.     inline
  579.         $205F, $4E90;
  580. {$ENDC}
  581.  
  582.  
  583. { WASTE PUBLIC CALLS }
  584.  
  585. { getting the shared library version number }
  586.  
  587.     function WEVersion: NumVersion;
  588.  
  589. { creation and destruction }
  590.  
  591.     function WENew ({const} var destRect, viewRect: LongRect;
  592.                                     flags: LongInt;
  593.                                     var we: WEReference): OSErr;
  594.     procedure WEDispose (we: WEReference);
  595.  
  596. { getting variables }
  597.  
  598.     function WEGetText (we: WEReference): Handle;
  599.     function WEGetChar (offset: LongInt;
  600.                                     we: WEReference): Char;
  601.     function WEGetTextLength (we: WEReference): LongInt;
  602.     function WECountLines (we: WEReference): LongInt;
  603.     function WEGetHeight (startLine, endLine: LongInt;
  604.                                     we: WEReference): LongInt;
  605.     procedure WEGetSelection (var selStart, selEnd: LongInt;
  606.                                     we: WEReference);
  607.     procedure WEGetDestRect (var destRect: LongRect;
  608.                                     we: WEReference);
  609.     procedure WEGetViewRect (var viewRect: LongRect;
  610.                                     we: WEReference);
  611.     function WEIsActive (we: WEReference): Boolean;
  612.     function WEOffsetToLine (offset: LongInt;
  613.                                     we: WEReference): LongInt;
  614.     procedure WEGetLineRange (lineNo: LongInt;
  615.                                     var lineStart, lineEnd: LongInt;
  616.                                     we: WEReference);
  617.     function WEGetClickCount (we: WEReference): Integer;
  618.  
  619. { setting variables }
  620.  
  621.     procedure WESetSelection (selStart, selEnd: LongInt;
  622.                                     we: WEReference);
  623.     procedure WESetDestRect ({const} var destRect: LongRect;
  624.                                     we: WEReference);
  625.     procedure WESetViewRect ({const} var viewRect: LongRect;
  626.                                     we: WEReference);
  627.  
  628. { accessing style run information }
  629.  
  630.     function WEContinuousStyle (var mode: WEStyleMode;
  631.                                     var ts: TextStyle;
  632.                                     we: WEReference): Boolean;
  633.     procedure WEGetRunInfo (offset: LongInt;
  634.                                     var info: WERunInfo;
  635.                                     we: WEReference);
  636.  
  637. { converting byte offsets to screen positions and vice versa }
  638.     function WEGetOffset ({const} var thePoint: LongPt;
  639.                                     var edge: SignedByte;
  640.                                     we: WEReference): LongInt;
  641.     procedure WEGetPoint (offset: LongInt;
  642.                                     direction: Integer;
  643.                                     var thePoint: LongPt;
  644.                                     var lineHeight: Integer;
  645.                                     we: WEReference);
  646.  
  647. { finding words and lines }
  648.     procedure WEFindWord (offset: LongInt;
  649.                                     edge: SignedByte;
  650.                                     var wordStart, wordEnd: LongInt;
  651.                                     we: WEReference);
  652.     procedure WEFindLine (offset: LongInt;
  653.                                     edge: SignedByte;
  654.                                     var lineStart, lineEnd: LongInt;
  655.                                     we: WEReference);
  656.  
  657. { making a copy of a text range }
  658.  
  659.     function WECopyRange (rangeStart, rangeEnd: LongInt;
  660.                                     hText: Handle;
  661.                                     hStyles: StScrpHandle;
  662.                                     hSoup: WESoupHandle;
  663.                                     we: WEReference): OSErr;
  664.  
  665. { getting and setting the alignment style }
  666.  
  667.     function WEGetAlignment (we: WEReference): WEAlignment;
  668.     procedure WESetAlignment (alignment: WEAlignment;
  669.                                     we: WEReference);
  670.  
  671. { recalculating line breaks, drawing and scrolling }
  672.  
  673.     function WECalText (we: WEReference): OSErr;
  674.     procedure WEUpdate (updateRgn: RgnHandle;
  675.                                     we: WEReference);
  676.     procedure WEScroll (hOffset, vOffset: LongInt;
  677.                                     we: WEReference);
  678.     procedure WESelView (we: WEReference);
  679.  
  680. { handling activate/deactivate events }
  681.  
  682.     procedure WEActivate (we: WEReference);
  683.     procedure WEDeactivate (we: WEReference);
  684.  
  685. { handling key-down events }
  686.  
  687.     procedure WEKey (key: Char;
  688.                                     modifiers: EventModifiers;
  689.                                     we: WEReference);
  690.  
  691. { handling mouse-down events and mouse tracking }
  692.  
  693.     procedure WEClick (hitPt: Point;
  694.                                     modifiers: EventModifiers;
  695.                                     clickTime: LongInt;
  696.                                     we: WEReference);
  697.  
  698. { adjusting the cursor shape }
  699.  
  700.     function WEAdjustCursor (mouseLoc: Point;
  701.                                     mouseRgn: RgnHandle;
  702.                                     we: WEReference): Boolean;
  703.  
  704. { blinking the caret }
  705.  
  706.     procedure WEIdle (var maxSleep: LongInt;
  707.                                     we: WEReference);
  708.  
  709. { modifying the text and the styles }
  710.  
  711.     function WEInsert (pText: Ptr;
  712.                                     textLength: LongInt;
  713.                                     hStyles: StScrpHandle;
  714.                                     hSoup: WESoupHandle;
  715.                                     we: WEReference): OSErr;
  716.     function WEDelete (we: WEReference): OSErr;
  717.     function WESetStyle (mode: WEStyleMode;
  718.                                     {const} var ts: TextStyle;
  719.                                     we: WEReference): OSErr;
  720.     function WEUseText (hText: Handle;
  721.                                     we: WEReference): OSErr;
  722.     function WEUseStyleScrap (hStyles: StScrpHandle;
  723.                                     we: WEReference): OSErr;
  724.  
  725. { undo }
  726.  
  727.     function WEUndo (we: WEReference): OSErr;
  728.     procedure WEClearUndo (we: WEReference);
  729.     function WEGetUndoInfo (var redoFlag: Boolean;
  730.                                     we: WEReference): WEActionKind;
  731.     function WEIsTyping (we: WEReference): Boolean;
  732.  
  733. { keeping track of changes }
  734.  
  735.     function WEGetModCount (we: WEReference): LongInt;
  736.     procedure WEResetModCount (we: WEReference);
  737.  
  738. { embedded objects }
  739.  
  740.     function WEInstallObjectHandler (objectType: FlavorType;
  741.                                     handlerSelector: WESelector;
  742.                                     handler: ProcPtr;
  743.                                     we: WEReference): OSErr;
  744.     function WEGetObjectHandler (objectType: FlavorType;
  745.                                     handlerSelector: WESelector;
  746.                                     var handler: ProcPtr;
  747.                                     we: WEReference): OSErr;
  748.     function WEInsertObject (objectType: FlavorType;
  749.                                     objectDataHandle: Handle;
  750.                                     objectSize: Point;        { (0, 0) means default size }
  751.                                     we: WEReference): OSErr;
  752.     function WEGetSelectedObject (var objectRef: WEObjectReference;
  753.                                     we: WEReference): OSErr;
  754.     function WEFindNextObject (offset: LongInt;
  755.                                     var objectRef: WEObjectReference;
  756.                                     we: WEReference): LongInt;
  757.     function WEUseSoup (hSoup: WESoupHandle;
  758.                                     we: WEReference): LongInt;
  759.  
  760. { accessing embedded object attributes }
  761.     function WEGetObjectType (objectRef: WEObjectReference): FlavorType;
  762.     function WEGetObjectDataHandle (objectRef: WEObjectReference): Handle;
  763.     function WEGetObjectSize (objectRef: WEObjectReference): Point;
  764.     function WEGetObjectOwner (objectRef: WEObjectReference): WEReference;
  765.     function WEGetObjectRefCon (objectRef: WEObjectReference): LongInt;
  766.     procedure WESetObjectRefCon (objectRef: WEObjectReference;
  767.                                     refCon: LongInt);
  768.  
  769. { Clipboard operations }
  770.     function WECut (we: WEReference): OSErr;
  771.     function WECopy (we: WEReference): OSErr;
  772.     function WEPaste (we: WEReference): OSErr;
  773.     function WECanPaste (we: WEReference): Boolean;
  774.  
  775. { Drag Manager support }
  776.     function WEGetHiliteRgn (rangeStart, rangeEnd: LongInt;
  777.                                     we: WEReference): RgnHandle;
  778.     function WETrackDrag (message: DragTrackingMessage;
  779.                                     drag: DragReference;
  780.                                     we: WEReference): OSErr;
  781.     function WEReceiveDrag (drag: DragReference;
  782.                                     we: WEReference): OSErr;
  783.     function WECanAcceptDrag (drag: DragReference;
  784.                                     we: WEReference): Boolean;
  785.     function WEDraggedToTrash (drag: DragReference): Boolean;
  786.  
  787. { Script Manager utilities }
  788.     function WECharByte (offset: LongInt;
  789.                                     we: WEReference): Integer;
  790.     function WECharType (offset: LongInt;
  791.                                     we: WEReference): Integer;
  792.  
  793. { Text Services Manager support }
  794.     function WEInstallTSMHandlers: OSErr;
  795.     function WERemoveTSMHandlers: OSErr;
  796.     procedure WEStopInlineSession (we: WEReference);
  797.  
  798. { additional features }
  799.     function WEFeatureFlag (feature: Integer;
  800.                                     action: Integer;
  801.                                     we: WEReference): Integer;
  802.     function WEGetInfo (selector: WESelector;
  803.                                     info: univ Ptr;
  804.                                     we: WEReference): OSErr;
  805.     function WESetInfo (selector: WESelector;
  806.                                     info: univ Ptr;
  807.                                     we: WEReference): OSErr;
  808.  
  809. { long coordinates utility routines }
  810.     procedure WELongPointToPoint ({const} var lp: LongPt;
  811.                                     var p: Point);
  812.     procedure WEPointToLongPoint (p: Point;
  813.                                     var lp: LongPt);
  814.     procedure WESetLongRect (var lr: LongRect;
  815.                                     left, top, right, bottom: LongInt);
  816.     procedure WELongRectToRect ({const} var lr: LongRect;
  817.                                     var r: Rect);
  818.     procedure WERectToLongRect ({const} var r: Rect;
  819.                                     var lr: LongRect);
  820.     procedure WEOffsetLongRect (var lr: LongRect;
  821.                                     hOffset, vOffset: LongInt);
  822.     function WELongPointInLongRect ({const} var lp: LongPt;
  823.                                     {const} var lr: LongRect): Boolean;
  824.  
  825. {$ALIGN RESET}
  826. {$POP}
  827.  
  828. implementation
  829. end.